import 'package:flutter_fronter_service/generated/json/base/json_convert_content.dart';
import 'package:flutter_fronter_service/model/order_entity.dart';

OrderEntity $OrderEntityFromJson(Map<String, dynamic> json) {
  final OrderEntity orderEntity = OrderEntity();
  final int? id = jsonConvert.convert<int>(json['id']);
  if (id != null) {
    orderEntity.id = id;
  }
  final String? orderRemark = jsonConvert.convert<String>(json['orderRemark']);
  if (orderRemark != null) {
    orderEntity.orderRemark = orderRemark;
  }
  final String? deliveryTime = jsonConvert.convert<String>(
      json['deliveryTime']);
  if (deliveryTime != null) {
    orderEntity.deliveryTime = deliveryTime;
  }
  final int? orderAmount = jsonConvert.convert<int>(json['orderAmount']);
  if (orderAmount != null) {
    orderEntity.orderAmount = orderAmount;
  }
  final int? createTime = jsonConvert.convert<int>(json['createTime']);
  if (createTime != null) {
    orderEntity.createTime = createTime;
  }
  final int? updateTime = jsonConvert.convert<int>(json['updateTime']);
  if (updateTime != null) {
    orderEntity.updateTime = updateTime;
  }
  final int? orderState = jsonConvert.convert<int>(json['orderState']);
  if (orderState != null) {
    orderEntity.orderState = orderState;
  }
  return orderEntity;
}

Map<String, dynamic> $OrderEntityToJson(OrderEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['orderRemark'] = entity.orderRemark;
  data['deliveryTime'] = entity.deliveryTime;
  data['orderAmount'] = entity.orderAmount;
  data['createTime'] = entity.createTime;
  data['updateTime'] = entity.updateTime;
  data['orderState'] = entity.orderState;
  return data;
}

extension OrderEntityExtension on OrderEntity {
  OrderEntity copyWith({
    int? id,
    String? orderRemark,
    String? deliveryTime,
    int? orderAmount,
    int? createTime,
    int? updateTime,
    int? orderState,
  }) {
    return OrderEntity()
      ..id = id ?? this.id
      ..orderRemark = orderRemark ?? this.orderRemark
      ..deliveryTime = deliveryTime ?? this.deliveryTime
      ..orderAmount = orderAmount ?? this.orderAmount
      ..createTime = createTime ?? this.createTime
      ..updateTime = updateTime ?? this.updateTime
      ..orderState = orderState ?? this.orderState;
  }
}